//请求远程数据
this.ajax({url:'/user/exportUserBarCode',data:_data}).then(res=>{
	if(res.code=='0'){
		let exportUsers = res.data , eleItems = "";
		
		//条形码格式
		exportUsers.forEach((item,i)=>{
			eleItems+=`
				<div class="item">
					<svg id="barCode${i}"></svg>
					<div><span>${item.username}</span><span>${item.sex}</span></div>
					<div><span>${item.grade}</span><span>${item.clazz}</span></div>
				</div>
			`
		})
		
		//全屏loading关闭
		this.$root.__proto__.loading.close();
		
		//在新tab页面生成条形码并排版
		let win = window.open("", "", "");
		win.opener = null;
		win.window.exportUsers = exportUsers;
		win.document.write(eleItems);
		let JsBarcode = document.createElement("script") , script = document.createElement("script") , style = document.createElement("style");
		JsBarcode.src = "https://cdn.bootcss.com/jsbarcode/3.11.0/barcodes/JsBarcode.code128.min.js";	//条形码插件
		script.innerHTML=`
			var timer = setInterval(function(){
				if(JsBarcode){
					for (var i = 0; i < exportUsers.length; i++) {
						JsBarcode("#barCode"+i,exportUsers[i].userid,{
							width:0.76,
							height:50,
							displayValue:false
						})
					} 
					window.print();	//打印
					clearInterval(timer)
				}
			},100)
		`;
		style.innerHTML=`
			body{padding:0;margin:0;}
			.item{display:inline-block;text-align:center;margin-bottom:28px;}
			.item div span{margin:0 5px;font-size:12px}
		`;
		win.document.head.appendChild(style);
		win.document.body.appendChild(JsBarcode);
		win.document.body.appendChild(script);
		win.document.close();
	}else{
		alert(res.message)
	}
},err=>{
	console.log(err.message || err)
	alert('服务器请求失败')
})